#include <stddef.h>
#include "JctoDll.h"

#if defined(_WIN32)

#elif defined(__linux__)
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
#else
#error
#endif

JctoDll jctoDllLoad(const char*dllName)
{
#if defined(_WIN32)
    return LoadLibrary(dllName);
#elif defined(__linux__)
    return dlopen(dllName,RTLD_NOW);
#else
#error
#endif
}

JctoDll jctoDllUnLoad(JctoDll dll)
{
#if defined(_WIN32)
    FreeLibrary(dll);
#elif defined(__linux__)
    dlclose(dll);
#else
#error
#endif
    return NULL;
}

void*jctoDllGetFunction(JctoDll dll,const char*name)
{
#if defined(_WIN32)
    return GetProcAddress(dll,name);
#elif defined(__linux__)
    return dlsym(dll,name);
#else
#error
#endif
}
